[FIX] python: install a setuptools that can build Odoo's dependencies - #135
Merged
Conversation
brinkflew
force-pushed
the
avs-open-issues
branch
from
March 24, 2026 10:38
95b9865 to
90dccc7
Compare
brinkflew
force-pushed
the
avs-open-issues
branch
from
April 17, 2026 14:54
90dccc7 to
1fe7fdb
Compare
brinkflew
force-pushed
the
avs-open-issues
branch
from
July 26, 2026 14:42
208329f to
c911c78
Compare
brinkflew
marked this pull request as draft
July 26, 2026 18:11
Installing Odoo's requirements failed on `gevent` with `BackendUnavailable: Cannot import 'setuptools.build_meta'`: odev pinned setuptools to 58-59 for python 3.8 to 3.11, and those versions cannot serve as a PEP 517 backend for current pip, which is what `--no-build-isolation` builds against. The floor is raised to 69. It is also capped below 82, which removed `pkg_resources`. Odoo 15.0 and 16.0 import it unconditionally in `odoo/modules/module.py` and odev runs both on python 3.10, where an uncapped requirement resolves to setuptools 83 and `odoo-bin` stops importing altogether. Users who upgraded setuptools by hand to work around this issue will see it downgraded. Neither bound had any effect before, because requirements were parsed with a regular expression capturing a single operator and version, and expecting the environment marker to follow the version immediately. Any requirement combining two bounds lost the second one *and* its marker: the existing `setuptools>=58.0.0, <59.0.0; python_version >= '3.8' and python_version < '3.12'` had always been read as an unconditional `setuptools>=58.0.0`. Requirements are now parsed with `packaging.requirements.Requirement`, which also removes the `eval()` of the comparison and of the marker. Markers are evaluated against the python of the virtual environment the requirements are being installed into, not against the interpreter odev runs under, so a requirement conditioned on the python version resolves for the Odoo installation it is meant for. Odoo builds several of its dependencies from source, and those builds fail with errors that do not name the system library they are missing. When creating a virtual environment, odev now lists the system packages Odoo declares in `setup/debinstall.sh` that are not installed, warns about them and offers to run the script. Detection uses the script's `--list` mode, which needs no privileges, and is skipped outside of Debian-based systems and for the versions of Odoo that predate the script. The prompt defaults to declining, since prompts return their default when running with `--force`, in headless mode and under tests, and the script is run through an explicit `sudo` because it silently downgrades to a dry run and exits successfully when not run as root. Closes #93
The system dependency check introduced with the setuptools fix only worked on Debian and Ubuntu: it listed the packages Odoo declares in `debian/control` and offered to run `setup/debinstall.sh` with `sudo`. On macOS, Fedora or Arch it reported nothing at all, and the user only found out something was missing when the build of gevent failed in the compiler. Odev does not control the machine it runs on, so it now describes what is missing in plain words and, when it recognizes the package manager, prints the command installing it. It no longer runs that command itself. Where Odoo lists its own packages they are still used, and anywhere else the check falls back to probing what an executable on the `PATH` proves present, so that nothing is reported as missing on a distribution that names it differently. The development headers of python are checked on every system: `debian/control` asks for `python3-dev`, which is not necessarily the version of python the Odoo installation is built against. `PythonEnv.install_system_packages` used to raise `Neither dnf or apt package managers found on the system` when it ran anywhere else, naming neither the packages to install nor a way to move forward. It now reports them and returns whether it installed anything, so that `create` gives up once instead of asking the same question again on a system where the answer cannot change. Claude-Session: https://claude.ai/code/session_01K8csZBrrBYp8oqH5paxTAm
brinkflew
force-pushed
the
avs-open-issues
branch
from
July 27, 2026 00:20
c911c78 to
aeb7061
Compare
brinkflew
marked this pull request as ready for review
July 27, 2026 00:29
|
Just FYI, |
Contributor
Author
|
Yes, correct, but this only works for Debian-based distributions. Fedora, Arch and MacOS users cannot run it, so we need another way to cover that.
|
sea-odoo
previously approved these changes
Jul 30, 2026
This was referenced Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Installing Odoo's requirements failed on
geventwithBackendUnavailable: Cannot import 'setuptools.build_meta': odev pinned setuptools to 58–59 for python 3.8 to 3.11, and those versionscannot serve as a PEP 517 backend for current pip, which is what
--no-build-isolationbuildsagainst. The floor is raised to 69.
It is also capped below 82, which removed
pkg_resources. Odoo 15.0 and 16.0 import itunconditionally in
odoo/modules/module.pyand odev runs both on python 3.10, where an uncappedrequirement resolves to setuptools 83 and
odoo-binstops importing altogether.Neither bound had any effect before, because requirements were parsed with a regular expression
capturing a single operator and version and expecting the environment marker to follow the version
immediately. Any requirement combining two bounds lost the second one and its marker: the existing
setuptools>=58.0.0, <59.0.0; python_version >= '3.8' and python_version < '3.12'had always beenread as an unconditional
setuptools>=58.0.0. Requirements are now parsed withpackaging.requirements.Requirement, which also removes theeval()of the comparison and of themarker. Markers are evaluated against the python of the virtual environment being installed into,
not against the interpreter odev runs under, so a requirement conditioned on the python version
resolves for the Odoo installation it is meant for.
Missing system dependencies are now reported on any operating system
Odoo builds several of its dependencies from source, and those builds fail with errors that do not
name the system library they are missing — which is how #93 presents itself before it is diagnosed.
When creating a virtual environment, odev now says what is missing and, when it recognizes the
package manager, prints the command that installs it. It never installs anything itself.
Odev does not control the machine it runs on, so the check works everywhere:
setup/debinstall.sh --list, whichonly echoes what it parses out of
debian/controland needs no privileges — that list is usedas-is.
PATHproves present, sothat nothing is ever reported as missing on a distribution that merely names it differently.
debian/controlasksfor
python3-dev, which is not necessarily the version of python the Odoo installation is builtagainst.
The new
odev/common/system.pyholds the whole platform vocabulary: package managers (apt-get,dnf,zypper,pacman,apk,brew, distribution managers before Homebrew), and eachdependency with its per-manager package name and the executables proving it installed.
PythonEnv.install_system_packagesused to raiseNeither dnf or apt package managers found on the systemanywhere else, naming neither the packages to install nor a way to move forward — reachedfrom
create()whenever virtualenv cannot find the interpreter for an Odoo version, soodev rundead-ended on Fedora, Arch and macOS. It now reports them and returns whether it installed anything,
so
creategives up once instead of asking the same question again on a system where the answercannot change. It still runs the install on apt and dnf, unchanged: that path is pre-existing,
already sits behind two confirmations, and is how users get
python3.10installed. Naming a packagefor pacman is safe, running
sudowith a guessed name on a distribution odev has never been testedagainst is not.
Risks worth knowing before merging
<82cap downgrades setuptools for anyone who raised it by hand to work around this issue— which is exactly what the reporter did. That is the intended repair for Odoo 15.0 and 16.0, but
it will surprise people.
just this one. Markers that were silently dropped are now applied, so packages that used to be
installed on the wrong python version correctly stop being installed. It has its own commit.
Note for reviewers
The two commits are worth reading separately: the first is the setuptools and requirements-parser
fix, the second replaces the Debian-only dependency check it shipped with — including its
sudo debinstall.shprompt, which is gone — with the cross-platform one described above. Theparagraph about that prompt in the first commit message is superseded by the second.
Tests: the setuptools specifier is asserted through
packaging(at python 3.10 it must admit 69 and81.2 and reject 58 — the #93 regression — and 82, the
pkg_resourcesregression; at 3.7 it keepsthe legacy cap);
missing_requirementsis covered for two-bound specifiers and for markersevaluated against the environment python. For the cross-platform half, the regression guard is a
darwinsystem with no compiler and nopg_config, which today reports nothing; plus a newtests/tests/common/test_system.py, and assertions that no path ever shells out. Full test suitepasses.
Linked Issues
Compliance
docsdirectoryrequirements.txtfile, if any🤖 Generated with Claude Code
https://claude.ai/code/session_01K8csZBrrBYp8oqH5paxTAm